﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="XiTongCai.aspx.cs" Inherits="PropertyAppraisal.SystemManage.XiTongCai" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>菜单管理</title>
    <link href="../jquery-easyui-1.3.5/themes/default/easyui.css" rel="stylesheet" />

    <link href="../easyui/easyui/1.3.2/themes/icon.css" rel="stylesheet" />
    <script type="text/javascript" src="../jquery-easyui-1.3.5/jquery-1.7.2-min.js"></script>
    <script type="text/javascript" src="../jquery-easyui-1.3.5/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../jquery-easyui-1.3.5/easyloader.js"></script>
    <script src="../easyui/easyui/1.3.2/locale/easyui-lang-zh_CN.js"></script>
</head>
<body>
    <div fit="true">
        <div style="padding: 3px">
            <input id="name" class="easyui-textbox" type="text" name="deptname" data-options="required:true" placeholder="请输入菜单名称查询" maxlength="20" />
            <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',toggle:true" id="search" >查询</a>
        </div>
            <iframe width="0" height="0" src="../SessionKeeper.aspx"></iframe>   
        <table id="ta" title="菜单列表" style="width: 1190px; height: 600px" data-options="
				singleSelect:true,
				autoRowHeight:false,
				pagination:true,
				pageSize:10">
            <thead>
                <tr>
                    <th field="Id" width="100" align="center">序号</th>
                    <th field="authority_Id" width="100" align="center">菜单编号</th>
                    <th field="authority_Name" width="150" align="center">菜单名称</th>
                    <th field="ParentName" width="200" align="center">父菜单名称</th>
                    <th field="authority_Url" width="416" align="center">URL</th>
                    <th field="authority_CreatePeople" width="200" align="center">创建人</th>
                </tr>
            </thead>
        </table>
    </div>
    <script type="text/javascript">


        //表格
        function getData(obj) {
            var rows = [];
         
            $.ajax({
                type: "post", //要用post方式                 
                url: "XiTongCai.aspx/AuthorityList",//方法所在页面和方法名
                contentType: "application/json; charset=utf-8",
                data: "{ 'name': '" + obj + "' }",
                dataType: "json",
                async: false,
                success: function (result) {
                    var json = eval("(" + result.d + ")");
                    for (var i = 0; i < json.length; i++) {
                        rows.push({
                            Id: i + 1,
                            authority_Id: json[i].authority_Id,
                            authority_Name: json[i].authority_Name,
                            ParentName: json[i].ParentName,
                            authority_Url: json[i].authority_Url,
                            authority_CreatePeople: json[i].authority_CreatePeople,
                        });
                    }
                }
            })
            return rows;
        }
        $("#search").bind('click', function () {
            data();
        })


        function pagerFilter(data) {
            if (typeof data.length == 'number' && typeof data.splice == 'function') {	// is array
                data = {
                    total: data.length,
                    rows: data
                }
            }
            var dg = $(this);
            var opts = dg.datagrid('options');
            var pager = dg.datagrid('getPager');
            pager.pagination({
                onSelectPage: function (pageNum, pageSize) {
                    opts.pageNumber = pageNum;
                    opts.pageSize = pageSize;
                    pager.pagination('refresh', {
                        pageNumber: pageNum,
                        pageSize: pageSize
                    });
                    dg.datagrid('loadData', data);
                },
                onRefresh: function (pageNum, pageSize) {
                    var name = $("#name").val();
                    $('#ta').datagrid({ loadFilter: pagerFilter }).datagrid('loadData', getData(name));
                }
            });
            if (!data.originalRows) {
                data.originalRows = (data.rows);
            }
            var start = (opts.pageNumber - 1) * parseInt(opts.pageSize);
            var end = start + parseInt(opts.pageSize);
            data.rows = (data.originalRows.slice(start, end));
            return data;
        }

        $(function () {
            data();
        });
        function data()
        {
            var name = $("#name").val();
            $('#ta').datagrid({ loadFilter: pagerFilter }).datagrid('loadData', getData(name));
        }
    </script>
</body>
</html>
